From 56e8e5c3f21f2885e298992c3504db5c9d33ae9d Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Thu, 16 Mar 2023 16:53:12 +0100
Subject: [PATCH] drmgr: disable hooks functionality

This relies on scandirat which musl does not have.
---
 src/drmgr/common.c          |  4 ++++
 src/drmgr/drmig_chrp_pmig.c | 18 +++---------------
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/src/drmgr/common.c b/src/drmgr/common.c
index 9cd91d1..d832407 100644
--- a/src/drmgr/common.c
+++ b/src/drmgr/common.c
@@ -69,12 +69,14 @@ static char *drc_type_str[] = {
 	[DRC_TYPE_ACC]		= "acc",
 };
 
+#if 0
 static char *hook_phase_name[] = {
 	[HOOK_CHECK]		= "check",
 	[HOOK_UNDOCHECK]	= "undocheck",
 	[HOOK_PRE]		= "pre",
 	[HOOK_POST]		= "post",
 };
+#endif
 
 /**
  * set_output level
@@ -1555,6 +1557,7 @@ enum drc_type to_drc_type(const char *arg)
 	return DRC_TYPE_NONE;
 }
 
+#if 0
 static int run_one_hook(enum drc_type drc_type,	enum hook_phase phase,
 			const char *name)
 {
@@ -1690,3 +1693,4 @@ int run_hooks(enum drc_type drc_type, enum hook_phase phase)
 	free(entries);
 	return rc;
 }
+#endif
diff --git a/src/drmgr/drmig_chrp_pmig.c b/src/drmgr/drmig_chrp_pmig.c
index f169fa5..1e133db 100644
--- a/src/drmgr/drmig_chrp_pmig.c
+++ b/src/drmgr/drmig_chrp_pmig.c
@@ -696,10 +696,6 @@ int drmig_chrp_pmig(void)
 {
 	int rc;
 	uint64_t stream_val;
-	enum drc_type drc_type = DRC_TYPE_NONE;
-
-	if (usr_action == MIGRATE)
-		drc_type = DRC_TYPE_MIGRATION;
 
 	/* Ensure that this partition is migratable/mobile */
 	if (! pmig_capable()) {
@@ -708,11 +704,9 @@ int drmig_chrp_pmig(void)
 		return -1;
 	}
 
-	if (usr_action == MIGRATE && (strcmp(usr_p_option, "check") == 0)) {
-		rc = run_hooks(drc_type, HOOK_CHECK);
-		if (rc)
-			run_hooks(drc_type, HOOK_UNDOCHECK);
-		return rc;
+	if (strcmp(usr_p_option, "check") == 0) {
+		say(DEBUG, "check: Nothing to do...\n");
+		return 0;
 	}
 
 	/* The only other command is pre, any other command is invalid */
@@ -735,9 +729,6 @@ int drmig_chrp_pmig(void)
 
 	/* Now do the actual migration */
 	do {
-		if (usr_action == MIGRATE)
-			run_hooks(drc_type, HOOK_PRE);
-
 		if (usr_action == MIGRATE)
 			rc = do_migration(stream_val);
 		else if (usr_action == HIBERNATE)
@@ -756,8 +747,5 @@ int drmig_chrp_pmig(void)
 	if (!rc)
 		post_mobility_update();
 
-	/* Post hook is called even if the migration has failed */
-	if (usr_action == MIGRATE)
-		run_hooks(drc_type, HOOK_POST);
 	return rc;
 }
-- 
2.39.0

